package com.dxg.msns.common.pojo;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

/**
 * 关注实体类
 * 对应数据库表：follow
 * 
 * @author system
 */
@Table(name = "follow")
public class Follow implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID自增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 关注者ID
     */
    @Column(name = "Followers_id")
    private String followersId;

    /**
     * 被关注者ID
     */
    @Column(name = "beFollowers_id")
    private String beFollowersId;

    /**
     * 关注时间
     */
    @Column(name = "follower_date")
    private Date followerDate;

    // 构造方法
    public Follow() {
    }

    public Follow(String followersId, String beFollowersId) {
        this.followersId = followersId;
        this.beFollowersId = beFollowersId;
        this.followerDate = new Date();
    }

    // Getter 和 Setter 方法
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getFollowersId() {
        return followersId;
    }

    public void setFollowersId(String followersId) {
        this.followersId = followersId;
    }

    public String getBeFollowersId() {
        return beFollowersId;
    }

    public void setBeFollowersId(String beFollowersId) {
        this.beFollowersId = beFollowersId;
    }

    public Date getFollowerDate() {
        return followerDate;
    }

    public void setFollowerDate(Date followerDate) {
        this.followerDate = followerDate;
    }

    @Override
    public String toString() {
        return "Follow{" +
                "id=" + id +
                ", followersId='" + followersId + '\'' +
                ", beFollowersId='" + beFollowersId + '\'' +
                ", followerDate=" + followerDate +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        Follow follow = (Follow) o;

        if (!followersId.equals(follow.followersId))
            return false;
        return beFollowersId.equals(follow.beFollowersId);
    }

    @Override
    public int hashCode() {
        int result = followersId.hashCode();
        result = 31 * result + beFollowersId.hashCode();
        return result;
    }
}